<html lang="en">

<head>
    <script src="https://d3js.org/d3.v3.js"></script>
</head>

<body>
    <script type="text/javascript" charset="utf-8">
        var svg = d3.select("body").append("svg")
        svg.append("rect").attr("width", 100).attr("height", 100).attr("fill", "red")
        .on("mouseover", function(){
            d3.select(this).attr("fill", "yellow");  // select(this) 选择当前的元素
        })
    </script>

</body>

</html>
